package com.ww.aviator;

import com.googlecode.aviator.AviatorEvaluator;
import com.googlecode.aviator.Expression;

import java.io.IOException;

public class RunScriptDemo {

    public static void main(String[] args) throws IOException {
        test01();
    }

    public static void test01() throws IOException {
        // 加载文件
        Expression exp = AviatorEvaluator.getInstance().compileScript("D:\\code\\gitee\\java-learn\\src\\main\\java\\com\\ww\\aviator\\bigInt.av");
        exp.execute();
    }

    public static void test02() {
        // 加载表达式
        Expression script = AviatorEvaluator.getInstance().compile("println('Hello, AviatorScript!')");
        script.execute();
    }

    public static void test03() {
        String expression = "a-(b-c) > 100";
        Expression compile = AviatorEvaluator.compile(expression);
        Boolean result = (Boolean) compile.execute(compile.newEnv("a", 100.3, "b", 35, "c", -199.1));
        System.out.println(result);
    }
}
